package com.xiaohong.user.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaohong.user.fallback.ChatUserFallback;
import com.xiaohong.user.pojo.User;
import entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name="xiaohong-chat-user",contextId = "chatUser",fallback= ChatUserFallback.class)
public interface ChatUserFeign {

    /***
     * 分页条件搜索实现ChatUser
     * @param user
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "/chatUser/search/{page}/{size}")
    Result<Page> findPage(@RequestBody(required = false) User user, @PathVariable int page, @PathVariable int size);

    /***
     * 分页搜索实现ChatUser
     * @param page:当前页
     * @param size:每页显示多少条
     * @return
     */
    @GetMapping(value = "/chatUser/search/{page}/{size}")
    Result<Page> findPage(@PathVariable int page, @PathVariable int size);

    /***
     * 多条件搜索ChatUser数据
     * @param user
     * @return
     */
    @PostMapping(value = "/chatUser/search")
    Result<List<User>>findList(@RequestBody(required = false) User user);

    /***
     * 根据Id删除chatUser数据
     * @param id
     * @return
     */
    @DeleteMapping(value = "/chatUser/{id}")
    Result delete(@PathVariable Long id);

    /***
     * 根据ID修改ChatUser数据
     * @param user
     * @return
     */
    @PutMapping(value = "/chatUser")
    Result update(@RequestBody User user);

    /***
     * 新增ChatUser数据
     * @param user
     * @return
     */
    @PostMapping(value = "/chatUser")
    Result add(@RequestBody User user);

    /***
     * 根据ID查询ChatUser数据
     * @param id
     * @return
     */
    @GetMapping("/chatUser/{id}")
    Result<User>findById(@PathVariable Long id);

    /***
     * 查询ChatUser全部数据
     * @return
     */
    @GetMapping(value = "/chatUser")
    Result<List<User>>findAll();

}
